<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:composition template="templateadmin1.xhtml">
        <ui:define name="content">
            <script  type="text/javascript">
              function testResults (form) {
                  var TestVar = form.elements["formnewhotel:txtPrice"];
                  var tax_id = parseFloat(TestVar.value);
                  if(isNaN(tax_id)){
                      alert ("You have input float");
                     TestVar.value=0;
                      return false;
                  }
                  return true;

             }
            </script>
            <center>
                <h1>New Hotels</h1>
                <h:form id="formnewhotel">
                    <table id="detail-table">
                        <tr>
                            <td>Place Name:</td>
                            <td>
                                <h:selectOneMenu value="#{mngHotelBean.hotel.placeID}" styleClass="styledselect_form_hungtl">
                                    <f:selectItems value="#{mngHotelBean.listPlaces}" var="place" itemValue="#{place.placeID}" itemLabel="#{place.placeName}"></f:selectItems>
                                </h:selectOneMenu>
                            </td>
                        </tr>
                        <tr>
                            <td>Hotel Name:</td>
                            <td><h:inputText value="#{mngHotelBean.hotel.hotelName}" styleClass="inp-form"></h:inputText></td>
                        </tr>
                        <tr>
                            <td>Rate :</td>
                            <td>
                                <h:selectOneMenu value="#{mngHotelBean.hotel.rate}" styleClass="styledselect_form_hungtl">
                                    <f:selectItem itemValue="1"  itemLabel="1"></f:selectItem>
                                    <f:selectItem itemValue="2" itemLabel="2"></f:selectItem>
                                    <f:selectItem itemValue="3" itemLabel="3"></f:selectItem>
                                    <f:selectItem itemValue="4" itemLabel="4"></f:selectItem>
                                    <f:selectItem itemValue="5" itemLabel="5"></f:selectItem>
                                </h:selectOneMenu>
                            </td>
                        </tr>
                        <tr>
                            <td>Price : </td>
                            <td>
                                <h:inputText id="txtPrice" value="#{mngHotelBean.hotel.price}" onblur="testResults(this.form)" styleClass="inp-form" required="true" requiredMessage="Please input price text"></h:inputText>
                                <br/>
                                <h:message for="txtPrice" styleClass="error-inner"></h:message>
                            </td>
                        </tr>
                        <tr>
                            <td>Images</td>
                            <td>
                                <p:fileUpload widgetVar="uploader2" fileUploadListener="#{uploadbean.fileUpload3}" id="UploadPath" auto="true" ></p:fileUpload>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <h:commandButton action="#{mngHotelBean.addNewHotelAction}" value="AddNew" styleClass="form-submit"></h:commandButton>
                            </td>
                        </tr>
                    </table>
                </h:form>
            </center>
        </ui:define>
    </ui:composition>
</html>

